PhpStorm Live Template & Postfix Snippets

All "Test assertion" Snippets

asseq

Generate a call to assert equals

asseq
.asseq : Assert equals
ANY → \$this->assertEquals($expectedVar#1:complete()$, $expr$);

Custom Postfix Template

asseq

Generate a call to assert equals already calling expected and actual variables.

asseq
<template name="asseq" value="$$this-&gt;assertEquals($$expected$VAR1$, $$actual$VAR2$);" description="" toReformat="true" toShortenFQNames="true">
<variable name="VAR1" expression="complete()" defaultValue="" alwaysStopAt="true" />
<variable name="VAR2" expression="complete()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="PHP Statement" value="true" />
</context>
</template>

av

Generate an actual variable for tests.

av
<template name="av" value="$$actual$COMPLETE$ = $EXPECTEDVALUE$;" description="Actual variable assignation" toReformat="true" toShortenFQNames="true">
<variable name="EXPECTEDVALUE" expression="complete()" defaultValue="" alwaysStopAt="true" />
<variable name="COMPLETE" expression="capitalize(regularExpression(phpSuggestVariableName(), &quot;\\$&quot;, &quot;&quot;))" defaultValue="" alwaysStopAt="true" />
<context>
<option name="PHP Expression" value="true" />
</context>
</template>

av

Generate an actual variable for tests.

av
.av : Create an expected variable
ANY -> \$actual$var:capitalize(groovyScript("if(_1) { _1.substring(1) } else { _1 }", phpSuggestVariableName()))$ = $expr$;$END$

Custom Postfix Template

ev

Generate an expected variable for tests

ev
<template name="ev" value="$$expected$COMPLETE$ = $EXPECTEDVALUE$;" description="Expected variable assignation" toReformat="false" toShortenFQNames="true">
<variable name="EXPECTEDVALUE" expression="complete()" defaultValue="" alwaysStopAt="true" />
<variable name="COMPLETE" expression="capitalize(regularExpression(phpSuggestVariableName(), &quot;\\$&quot;, &quot;&quot;))" defaultValue="" alwaysStopAt="true" />
<context>
<option name="PHP Expression" value="true" />
</context>
</template>

ev

Generate an expected variable for tests

ev
.ev : Create an expected variable
ANY -> \$expected$var:capitalize(groovyScript("if(_1) { _1.substring(1) } else { _1 }", phpSuggestVariableName()))$ = $expr$;$END$

Custom Postfix Template